/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "POLines")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "POLines.findAll", query = "SELECT p FROM POLines p"),
    @NamedQuery(name = "POLines.findByPolid", query = "SELECT p FROM POLines p WHERE p.polid = :polid"),
    @NamedQuery(name = "POLines.findByPOLQty", query = "SELECT p FROM POLines p WHERE p.pOLQty = :pOLQty"),
    @NamedQuery(name = "POLines.findByPOLRcvd", query = "SELECT p FROM POLines p WHERE p.pOLRcvd = :pOLRcvd"),
    @NamedQuery(name = "POLines.findByPOLCost", query = "SELECT p FROM POLines p WHERE p.pOLCost = :pOLCost"),
    @NamedQuery(name = "POLines.findByPOLContract", query = "SELECT p FROM POLines p WHERE p.pOLContract = :pOLContract")})
public class POLines implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "POLID")
    private Integer polid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POLQty")
    private int pOLQty;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POLRcvd")
    private boolean pOLRcvd;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POLCost")
    private float pOLCost;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POLContract")
    private boolean pOLContract;
    @JoinColumn(name = "POLPN", referencedColumnName = "StockID")
    @ManyToOne(optional = false)
    private StockCode polpn;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POLQtyRcvd")
    private int pOLQtyRcvd;
    
    //Variable to hold description
    @Transient
    private String description;

    public POLines() {
    }

    public POLines(Integer polid) {
        this.polid = polid;
    }

    public POLines(Integer polid, int pOLQty, boolean pOLRcvd, float pOLCost, boolean pOLContract) {
        this.polid = polid;
        this.pOLQty = pOLQty;
        this.pOLRcvd = pOLRcvd;
        this.pOLCost = pOLCost;
        this.pOLContract = pOLContract;
    }

    public Integer getPolid() {
        return polid;
    }

    public void setPolid(Integer polid) {
        this.polid = polid;
    }

    public StockCode getPolpn() {
        return polpn;
    }

    public void setPolpn(StockCode polpn) {
        this.polpn = polpn;
    }

    public int getPOLQty() {
        return pOLQty;
    }

    public void setPOLQty(int pOLQty) {
        this.pOLQty = pOLQty;
    }

    public boolean getPOLRcvd() {
        return pOLRcvd;
    }

    public void setPOLRcvd(boolean pOLRcvd) {
        this.pOLRcvd = pOLRcvd;
    }

    public float getPOLCost() {
        return pOLCost;
    }

    public void setPOLCost(float pOLCost) {
        this.pOLCost = pOLCost;
    }

    public boolean getPOLContract() {
        return pOLContract;
    }

    public void setPOLContract(boolean pOLContract) {
        this.pOLContract = pOLContract;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getpOLQtyRcvd() {
        return pOLQtyRcvd;
    }

    public void setpOLQtyRcvd(int pOLQtyRcvd) {
        this.pOLQtyRcvd = pOLQtyRcvd;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (polid != null ? polid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof POLines)) {
            return false;
        }
        POLines other = (POLines) object;
        if ((this.polid == null && other.polid != null) || (this.polid != null && !this.polid.equals(other.polid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.POLines[ polid=" + polid + " ]";
    }
    
}
